package com.qboot.filestorage.controller;

import com.qboot.common.entity.Result;
import com.qboot.filestorage.service.DefaultFileStorageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 对象存储
 *
 * @author Tellsea
 * @date 2023/2/16
 */
@Api(tags = "对象存储")
@RestController
@RequestMapping("/fileStorage")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class DefaultFileStorageController {

    private final DefaultFileStorageService defaultFileStorageService;

    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public Result upload(@RequestParam("file") MultipartFile file) {
        return defaultFileStorageService.upload(file);
    }
}
